<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>天天生鲜——首页</title>
    <script src="/static/buyer/js/jquery.min.js"></script>
    <link rel="stylesheet" href="/static/buyer/css/bootstrap.css"/>
    <script src="/static/buyer/js/bootstrap.js"></script>
    <style>
        /*调整导航内搜索框的居中*/
        .makepos {
            padding-top: 20px;
        }

        /*调整列表的激活颜色*/
        .list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus {
            background-color: #5cb85c;
            border-color: #4cae4c;
        }

        /*调整轮播图片高度*/
        .carousel-inner > .item > img, .carousel-inner > .item > a > img {
            line-height: 1;
            height: 300px;
        }

        /*调整竖向banner图片的高度*/
        .mypic {
            width: 100%;
            height: 150px;
        }

        /*调整面包屑导航的背景*/
        .breadcrumb {
            background-color: white;
        }

        /*调整水平线宽度*/
        hr {
            border-width: 2px;
            border-color: green;
        }
    </style>
</head>
<body>
<!--首页头部登陆导航-->
{% include 'buyer/nav.html' %}
<!--首页头部搜索栏导航-->
<header class="container">
    <div class="col-xs-12 col-sm-3">
        <img src="/static/buyer/images/logo.png"/>
    </div>
    <div class="col-xs-12 col-sm-6 makepos">
        <div class="input-group">
            <input type="text" class="form-control" placeholder="搜索商品">
            <span class="input-group-btn">
                    <button class="btn btn-success" type="button">搜&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;索</button>
                </span>
        </div><!-- /input-group -->
    </div>
    <div class="col-xs-12 col-sm-3">
        <a class="btn btn-success pull-right" href="/buyer/shopping_car_list/">
            <img src="/static/buyer/images/cart.png"/>我的购物车 <span class="badge">4</span>
        </a>
    </div>
</header>
<!--首页头部轮播列表栏导航-->
<menu class="container">
    <div class="col-xs-12 col-sm-2">
        <ul class="list-group">
            <li class="list-group-item active">全部商品分类</li>
            {% for goods_type in goods_type_list %}
                <li class="list-group-item">
                    <a href="#{{ goods_type.id }}">
                        <img width="15px" height="15px" src="/static/{{ goods_type.logo.name }}"/>&nbsp;&nbsp;
                        {{ goods_type.name }}>
                    </a>
                </li>
            {% endfor %}
        </ul>
    </div>
    <div class="col-xs-12 col-sm-10">
        <ul class="nav nav-tabs">
            <li role="presentation" class="active"><a href="index.html">首页</a></li>
            <li role="presentation"><a href="#">手机生鲜</a></li>
            <li role="presentation"><a href="#">抽奖</a></li>
        </ul>
        <div class="col-xs-12 col-sm-9">
            <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                <!-- Indicators -->
                <ol class="carousel-indicators">
                    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
                    <li data-target="#carousel-example-generic" data-slide-to="3"></li>
                </ol>
                <!-- Wrapper for slides -->
                <div class="carousel-inner" role="listbox">

                    {% for lb_goods in lb_goods_list %}
{#                        默认第一张显示   active：显示  如果不加：隐藏#}
                        {% if forloop.first %}
                            <div class="item active">
                                <img src="/static/{{ lb_goods.goodsimg.name }}">
                            </div>
                        {% else %}
                            <div class="item">
                                <img src="/static/{{ lb_goods.goodsimg.name }}">
                            </div>
                        {% endif %}
                    {% endfor %}

                    {% comment %}<div class="item ">
                        <img src="/static/buyer/images/slide.jpg">
                    </div>
                    <div class="item ">
                        <img src="/static/buyer/images/slide02.jpg">
                    </div>
                    <div class="item active">
                        <img src="/static/buyer/images/slide03.jpg">
                    </div>
                    <div class="item">
                        <img src="/static/buyer/images/slide04.jpg">
                    </div>{% endcomment %}
                </div>

                <!-- Controls -->
                <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                    <span class="sr-only">Previous</span>
                </a>
                <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                    <span class="sr-only">Next</span>
                </a>
            </div>
        </div>
        <div class="col-xs-12 col-sm-3">
            <img src="/static/buyer/images/adv01.jpg" class="mypic"/>
            <img src="/static/buyer/images/adv02.jpg" class="mypic"/>
        </div>
    </div>
</menu>
<!--商品分类列表水平栏-->
{% for goods_type in goods_type_list %}

    <section class="container" id="{{ goods_type.id }}">
        <div class="panel panel-success">
            <div class="panel-heading">{{ goods_type.name }}
                <div class="pull-right"><a
                        href="/buyer/more_list_v3/?goodstype_id={{ goods_type.id }}">查看更多...</a></div>
            </div>
            <div class="panel-body">
                <div class="col-xs-12 col-sm-2">
                    <img src="/static/{{ goods_type.logo }}" class="img-responsive">
                </div>
                {#  ret =goodstype_obj.goods_set.all 当前类型下的所有的商品#}
                {% for goods_obj in goods_type.goods_set.all %}
                    {# 显示前5个商品#}
                    {% if forloop.counter <= 5 %}
                        <div class="col-xs-12 col-sm-2">
                            <a href="/buyer/goods_detail/?id={{ goods_obj.id }}" class="thumbnail">
                                <p class="text-center">{{ goods_obj.name }}</p><br/>
                                <img src="/static/{{ goods_obj.goodsimg }}" class="img-responsive">
                                <p class="text-center">¥{{ goods_obj.price }}元</p>
                            </a>
                        </div>
                    {% endif %}
                {% endfor %}
            </div>
        </div>
    </section>


{% endfor %}


{# shift+ctrl+/#}

{% comment %}
{# 对应的是方式一#}
{% for dic in new_list %}

    <section class="container" id="{{ goodstype_obj.id }}">
        <div class="panel panel-success">
            <div class="panel-heading">{{ dic.goodstype_obj.name }}
                <div class="pull-right"><a
                        href="/buyer/more_goods_list/?goodstype_id={{ goodstype_obj.id }}">查看更多...</a></div>
            </div>

            <div class="panel-body">
                <div class="col-xs-12 col-sm-2">
                    <img src="/static/{{ dic.goodstype_obj.logo }}" class="img-responsive">
                </div>
                {% for goods_obj in dic.goods_obj_list %}

                    <div class="col-xs-12 col-sm-2">
                        <a href="/buyer/goods_details/?id={{ goods_obj.id }}" class="thumbnail">
                            <p class="text-center">{{ goods_obj.name }}</p><br/>
                            <img src="/static/{{ goods_obj.img.name }}" class="img-responsive">
                            <p class="text-center">¥{{ goods_obj.price }}元</p>
                        </a>
                    </div>
                {% endfor %}
            </div>
        </div>
    </section>


{% endfor %}
{% endcomment %}


{#footer 部分#}
{% include 'buyer/footer.html' %}
</body>
</html>